<div id="header">
	<div id='header_nav'>
		<div id='header_nav_l'><span id='date'>今天是<?php echo date("Y年m月d日") . " " . $this->common_data->_get_days_by_english(date("l"))?></span></div>
		<div id='header_nav_r'>
			<?php if (!empty($_SESSION)):?>
			<span id='welcome'>欢迎您：<?php echo $user_info['user_name']?>
				<?php if ($_SESSION['ucid'] != ADMIN_UCID):?>
					<?php if ($_SESSION['ucid'] == SOCIETY_UCID):?>
					<a id='to_backend' href='<?php echo BACKEND_SOCIETY_PATH?>'>进入社团后台</a>
					<?php elseif ($_SESSION['ucid'] == ASSOCIATION_UCID):?>
					<a id='to_backend' href='<?php echo BACKEND_ASSOCIATION_PATH?>'>进入<?php echo (!empty($user_info['department_name'])) ? $user_info['department_name'] : "个人管理" ?>后台</a>
					<?php elseif ($_SESSION['ucid'] == TEACHER_UCID):?>
					<a id='to_backend' href='<?php echo BACKEND_TEACHER_PATH?>'>进入指导老师后台</a>
					<?php endif;?>
					<?php if (url_contains("backend")):?>
					<a id='logout' title='登出' href='<?php echo base_url()?>index.php/frontend/login/logout'>&nbsp;&nbsp;&nbsp;&nbsp;</a>
					<?php else:?>
					<a id='logout' title='登出' onclick="$.post('/index.php/frontend/ajax_login/logout', function(data) {if (data == 'logout_succeed') {location.replace(location.href);}});">&nbsp;&nbsp;&nbsp;&nbsp;</a>
					<?php endif;?>
				<?php else :?>
				<a id='to_backend' href='<?php echo BACKEND_ADMIN_PATH ?>'>进入管理员后台</a>
				<a id='logout' title='登出' href='<?php echo base_url()?>index.php/<?php echo ADMIN_FOLDER?>/login/logout'>&nbsp;&nbsp;&nbsp;&nbsp;</a>
				<?php endif;?>
			</span>
			<?php endif;?>
			<div id="container">
				<div class="header-nav-button">
					<a href="" class="search toggle"><span>搜索</span></a>
					<?php if (empty($_SESSION)):?>
					<a href='<?php echo REGISTER_PATH ?>' class="register"><span>用户注册</span></a>
					<a href="" class="signin toggle"><span>用户登录</span></a>
					<?php endif;?>
				</div>
				<fieldset id="search_menu" class="<?php echo (!empty($_SESSION)) ? "login" : ""?>">
					<form id="search">
						<p>
							<label for="keywords">关键词</label>
							<input type="text" id="keywords"
								value="请输入关键词(1~20个数字或字符)"
								onclick="if(value==defaultValue)value=''"
								onblur="if(!value)value=defaultValue"
								onkeydown="if(value==defaultValue)value=''">
						</p>
						<p>
							<label for="search_category">搜索范围</label>
							<select id="search_category">
								<option value="" selected="selected">全部</option>
								<option value="<?php echo SOCIETY_UCID ?>">东大社团</option>
								<option value="<?php echo ASSOCIATION_UCID ?>">东大社联</option>
							</select>
						</p>
						<p>
							<label for="search_type">搜索类别</label>
							<select id="search_type">
								<option value="" selected="selected">全部</option>
								<option value="<?php echo NEWS_TYPE ?>">新闻</option>
								<option value="<?php echo ANNOUNCEMENT_TYPE ?>">公告</option>
							</select>
						</p>
	
						<div class="error" id='search_msg'></div>
						<div class="search_result" id='search_result'></div>
						<p class="submit_button">
							<input type="button" id="search_submit" value="搜索">
						</p>
						<p class="advanced_search">
							<a id="advanced_search_link" title="如果您对搜索结果不满意，可以尝试使用高级搜索" href="<?php echo ADVANCED_SEARCH_PATH ?>">高级搜索</a>
						</p>
					</form>
				</fieldset>
				
				<?php if (empty($_SESSION)):?>
				<fieldset id="signin_menu">
					<form id="signin">
						<p class='username'>
							<label for="name">用户名</label>
							<input type="text" id="username"
								value="请输入用户名"
								onclick="if(value==defaultValue)value=''"
								onblur="if(!value)value=defaultValue"
								onkeydown="if(value==defaultValue)value=''">
						</p>
						<p class='email' style='display: none;'>
							<label for="email">电子邮箱</label>
							<input type="text" id="email"
								value="请输入电子邮箱"
								onclick="if(value==defaultValue)value=''"
								onblur="if(!value)value=defaultValue"
								onkeydown="if(value==defaultValue)value=''">
						</p>
						<p>
							<label for="password">密码</label>
							<input type="password" id="password" >
						</p>
	
						<div class="error" id='login_msg'></div>
						<p class="submit_button">
							<input type="button" id="signin_submit" value="登入">
							<input type="checkbox" id="remember" value="1" >
        					<label for="remember" class='username'>记住用户名和密码</label>
        					<label for="remember" class='email' style='display: none;'>记住电子邮箱和密码</label>
						</p>
						<p class="login_mode username">
							<a id="email_login_link" title="点击此链接使用电子邮箱登录" style="cursor: pointer;">使用电子邮箱登录</a>
						</p>
						<p class="login_mode email" style='display: none;'>
							<a id="username_login_link" title="点击此链接使用用户名登录" style="cursor: pointer;">使用用户名登录</a>
						</p>
						<script>
						$(".login_mode a").click(function() {
							$('#login_msg').empty();
							if ($(this).parent().hasClass("username")) {
								$("#signin .username").css({ "display": "none" });
								$("#signin .email").css({ "display": "inline" });
							} else {
								$("#signin .username").css({ "display": "inline" });
								$("#signin .email").css({ "display": "none" });
							}
							
						});
						</script>
						<p class="regist_account">
							<a id="regist_account_link" title="如果您是社团负责人或者社联成员且在本站尚无账号，可以注册一个新账号" href="<?php echo REGISTER_PATH ?>">注册新账户</a>
						</p>
					</form>
				</fieldset>
				<?php endif;?>
			</div>
		</div>
	</div>
	
	<div id="logo">
		<h1>
			<span>N</span> <span>E</span> <span>U</span> <span>S</span> <span>A</span>
			<span>L</span>
		</h1>
		<p>
			<a target='_blank' href="http://www.neu.edu.cn">东北大学</a> - <a
				target='_blank' title='关于东北大学 - 学生社团联合会'
				href="<?php echo ASSOCIATION_ABOUT_PATH ?>">学生社团联合会</a>
		</p>
	</div>
</div>
<div id='show_announcement_dialog'>
	<div class="announcement preview" style='margin-top: 20px;'>
		<h2 id='title'></h2>
		<p id='contents'></p>
		<a target='_blank' id='author' title='' href=''></a><br />
		<span id='publish_time'></span>
	</div>
	<input type='hidden' id='prev' value=''>
	<input type='hidden' id='next' value=''>
	<input type='hidden' id='category' value=''>
</div>
<script>
$("#show_announcement_dialog").dialog({
	autoOpen: false,
	resizable: false,
	draggable: false,
	width: 600,
	height: 330,
	modal: true,
	buttons: {
		"<": function() {
			$(".ui-dialog-message").empty();
			if ($("#prev").val() != '') {
				ajax_get_announcement($("#prev").val(), $("#category").val());
			} else {
				$(".ui-dialog-message").html("<span class='tip cry'>&nbsp;&nbsp;&nbsp;&nbsp;悲剧了，没有找到上一篇公告</span>");
			}
		},
		">": function() {
			$(".ui-dialog-message").empty();
			if ($("#next").val() != '') {
				ajax_get_announcement($("#next").val(), $("#category").val());
			} else {
				$(".ui-dialog-message").html("<span class='tip cry'>&nbsp;&nbsp;&nbsp;&nbsp;悲剧了，没有找到下一篇公告</span>");
			}
		}
	}
});
$("div.ui-dialog-titlebar").hide();
$(".ui-dialog-buttonpane").append( "<div class='ui-dialog-message'><div>" );

$(".ui-widget-overlay").live('click', function() {
	$("#show_announcement_dialog").dialog('close');
	$(".ui-dialog-message").empty();
});
</script>